<?php
require(dirname(__FILE__) .'/check.php');

$infoSysArr = Cache::PhpFile('infoSys');


switch ($mudi){
	case 'vote':
		Vote();
		break;

	case 'message':
		$userSysArr = Cache::PhpFile('userSys');
		Message();
		break;

	case 'messageSend':
		MessageSend();
		break;

	case 'messageWrite':
		$webPathPart = '';
		MessageWrite();
		break;

	case 'contentSend':
		$userSysArr = Cache::PhpFile('userSys');
		ContentSend();
		break;

	default:
		die('err');
}

$DB->Close();





// 投票处理
function Vote(){
	global $DB,$infoSysArr;

	$dataID		= OT::GetInt2( OT::ParaArr('id') );
	$selItem	= OT::GetInt('selItem',-1);
	$webPathPart= Area::WppSign(OT::GetStr('webPathPart'));

	$voteexe = $DB->query('select IF_voteMode,IF_voteStr from '. OT_dbPref .'info where IF_ID='. $dataID);
		if (! $row = $voteexe->fetch()){
			die('投票信息读取失败');
		}
		$IF_voteMode	= $row['IF_voteMode'];
		$IF_voteStr		= $row['IF_voteStr'];
	unset($voteexe);

	if ($selItem>-1){
		$voteNewTime = time();
		$voteOldTime = intval(@$_SESSION[OT_SiteID .'voteOldTime']);
		if ($voteNewTime-$voteOldTime < $infoSysArr['IS_newsVoteSecond']){
			JS::AlertEnd('连续投票需相隔'. $infoSysArr['IS_newsVoteSecond'] .'秒.');
		}else{
			$_SESSION[OT_SiteID .'voteOldTime'] = $voteNewTime;
		}
	}

	if ($IF_voteMode>0){
		$voteItemArr	= array(49,49,49,49,49,49,49,49);
		$voteItem2Arr	= array(0,0,0,0,0,0,0,0);
		$voteArr		= explode(',',$IF_voteStr);
		if ($selItem>-1){
			for ($i=0; $i<count($voteArr); $i++){
				if ($selItem == $i){
					$voteArr[$i] ++;
				}
			}
			$newVoteStr = implode(',',$voteArr);
			$DB->query("update ". OT_dbPref ."info set IF_voteStr='". $newVoteStr ."' where IF_ID=". $dataID);
			if (isset($_SESSION[OT_SiteID .'newsVoteList'])){
				$_SESSION[OT_SiteID .'newsVoteList'] .= '['. $dataID .']';
			}else{
				$_SESSION[OT_SiteID .'newsVoteList'] = '['. $dataID .']';
			}
		}
		$voteCount	= 0;
		for ($i=0; $i<count($voteArr); $i++){
			$voteCount += $voteArr[$i];
		}
		if ($voteCount>0){
			for ($i=0; $i<count($voteArr); $i++){
				if ($voteArr[$i]>0){
					$voteItem2Arr[$i] = OT::NumFormat($voteArr[$i]/$voteCount,2)*100;
					$voteItemArr[$i] = 49 - OT::NumFormat($voteArr[$i]/$voteCount,2)*49;
				}
			}
		}

		if ($IF_voteMode == 1){
			echo('
			请选择您看到这篇文章的心情：已有<span class="font2_2">'. $voteCount .'</span>人表态<br />
			<table cellpadding="0" cellspacing="0" align="center" style="margin:0 auto;"><tr><td>
			<ul>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(0)">
					<tr><td align="center">'. $voteArr[0] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[0] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/1.gif" /></td></tr>
					<tr><td align="center">支持</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(1)">
					<tr><td align="center">'. $voteArr[1] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[1] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/2.gif" /></td></tr>
					<tr><td align="center">感动</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(2)">
					<tr><td align="center">'. $voteArr[2] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[2] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/3.gif" /></td></tr>
					<tr><td align="center">惊讶</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(3)">
					<tr><td align="center">'. $voteArr[3] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[3] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/4.gif" /></td></tr>
					<tr><td align="center">同情</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(4)">
					<tr><td align="center">'. $voteArr[4] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[4] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/5.gif" /></td></tr>
					<tr><td align="center">流汗</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(5)">
					<tr><td align="center">'. $voteArr[5] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[5] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/6.gif" /></td></tr>
					<tr><td align="center">鄙视</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(6)">
					<tr><td align="center">'. $voteArr[6] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[6] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/7.gif" /></td></tr>
					<tr><td align="center">愤怒</td></tr>
					</table>
				</li>
				<li>
					<table cellpadding="0" cellspacing="0" onclick="VoteDeal(7)">
					<tr><td align="center">'. $voteArr[7] .'</td></tr>
					<tr><td align="center"><div class="boxBorder"><div class="boxBlank" style="height:'. $voteItemArr[7] .'px;"></div></div></td></tr>
					<tr><td align="center"><img src="'. $webPathPart .'inc_img/mood/8.gif" /></td></tr>
					<tr><td align="center">难过</td></tr>
					</table>
				</li>
			</ul><div class="clr"></div>
			</td></tr></table>
			');
		}elseif ($IF_voteMode == 2){
			echo('
			请选择您看到这篇文章的表态：已有<span class="font2_2">'. $voteCount .'</span>人参与<br /><br />
			<div class="upDown">
				<div class="up" onclick="VoteDeal(0)">
					<div class="upa">顶一下</div><div class="upb">(<span id="upVoteNum">'. $voteArr[0] .'</span>)</div><div class="clr"></div>
					<div class="upc"><div class="upd" style="width:'. $voteItem2Arr[0] .'px;"></div></div><div class="upe"><span id="upVotePer">'. $voteItem2Arr[0] .'</span>%</div>
				</div>
				<div class="down" onclick="VoteDeal(1)">
					<div class="downa">踩一下</div><div class="downb">(<span id="downVoteNum">'. $voteArr[1] .'</span>)</div><div class="clr"></div>
					<div class="downc"><div class="downd" style="width:'. $voteItem2Arr[1] .'px;"></div></div><div class="downe"><span id="downVotePer">'. $voteItem2Arr[1] .'</span>%</div>
				</div>
			</div><div class="clr"></div>
			');
		}
		echo('
		<script language="javascript" type="text/javascript">
		try {
			setTimeout("VoteStyle()",500);
		}catch (e) {}
		');
		if (strpos(''. @$_SESSION[OT_SiteID .'newsVoteList'],'['. $dataID .']') !== false){
			echo('
			try {
				isUseVote = true;
			}catch (e) {}
			');
		}
		echo('
		</script>
		');
	}
	
}



// 评论处理
function Message(){
	global $DB,$systemArr,$userSysArr,$tplSysArr,$infoSysArr;

	$backURL	= Str::Filter(OT::PostStr('backURL'),'url');
	$infoID		= OT::PostInt('infoID');
	$isReply	= OT::PostInt('isReply');
	$replyUserID= OT::PostInt('replyUserID');
	$verCode	= strtolower(OT::PostStr('verCode'));
	$rndMd5		= OT::PostStr('rndMd5');

	if (OT_OpenVerCode && strpos($systemArr['SYS_verCodeStr'],'|newsReply|')!==false){
		if ($systemArr['SYS_verCodeMode'] == 20){
			$geetest = new Geetest();
			if (! $geetest->IsTrue('web')){
				die('alert("验证码错误，请重新验证.");ResetVerCode();');
			}
		}else{
			if ($verCode == '' || $verCode != strtolower($_SESSION['VerCode'. $systemArr['SYS_verCodeMode']])){
				die('alert("验证码错误.");ResetVerCode();');
			}
			$_SESSION['VerCode'. $systemArr['SYS_verCodeMode']] = '';
		}
	}

	$replyNewTime = time();
	$replyOldTime = intval(@$_SESSION[OT_SiteID .'replyOldTime']);
	if ($replyNewTime-$replyOldTime < $infoSysArr['IS_newsReplySecond']){
		die('alert("连续评论需相隔'. $infoSysArr['IS_newsReplySecond'] .'秒.");ResetVerCode();');
	}else{
		$_SESSION[OT_SiteID .'replyOldTime'] = $replyNewTime;
	}

	$username = '';
	if ($infoSysArr['IS_isNewsReply']==0 || $isReply==0){
		die('alert("评论已关闭.");');
	}elseif ($infoSysArr['IS_isNewsReply']==10 || $isReply==10){
		$username = Users::Username();
		if ($username == ''){
			die('alert("需要会员身份才能发表评论.");');
		}

		$userRow = Users::Open('get',',UE_username,UE_state,UE_authStr','',$judUserErr);
		if ($judUserErr != ''){
			die('alert("需要会员身份才能发表评论.");');
		}
		if ($userRow['UE_state'] == 0){
			die('alert("您的状态未审核，暂时无法发表评论，请联系管理员。");');
		}
		// 检测用户邮箱、手机号是否需要强制验证
		AreaApp::UserTixing($userRow['UE_authStr'], $userSysArr, 1, 'str');
	}

	if ($username == ''){
		if (strpos($tplSysArr['TS_messageEvent'],'|noRevName|') !== false){
			$username = '游客';
		}else{
			$username = OT::PostRegExpStr('replyUser','sql');
		}
	}
	$content	= OT::PostReplaceStr('replyContent','html');
	
	if ($infoID == 0 || $content == ''){
		die('alert("表单信息填写不完整.");ResetVerCode();');
	}

	$contentLen = mb_strlen($content);
	if ($infoSysArr['IS_newsReplyMaxLen'] > 0 && $contentLen > $infoSysArr['IS_newsReplyMaxLen']){
		die('alert("评论内容(已经'. $contentLen .'字符)超过系统限制的'. $infoSysArr['IS_newsReplyMaxLen'] .'字符.");ResetVerCode();');
	}

	$userIP	= Users::GetIp();
	$resultMd5 = md5(md5(OT_SiteID . session_id()) . OT_SiteID . $userIP);
	if ($tplSysArr['TS_messageRndMd5'] > 0){
		if ($rndMd5 != $resultMd5){
			if ($tplSysArr['TS_messageRndMd5'] == 2){
				die('alert("用户跟随信息验证失败，已重新更新，请再点提交下。");$id("rndMd5").value = "'. $resultMd5 .'";ResetVerCode();');
			}else{
				die('alert("用户跟随信息验证失败，请重新刷新页面后再操作。");ResetVerCode();');
			}
		}
	}

	$badWordArr = explode('|',$tplSysArr['TS_messageBadWord']);
	foreach ($badWordArr as $str){
		if ($str != ''){
			$alertStr='内容中含禁止关键词（'. $str .'）';
			if (strpos($content,$str) !== false){
				die('alert("'. $alertStr .'");');
			}
		}
	}

	$userID		= Users::UserID();
	if ($userID>0){ $username = Users::Username(); }
	$ipInfoArr = OT::GetIpInfoArr($userIP, OT::IpHidden($userIP));

	$addiContent = '';
	if ($replyUserID > 0){
		$row = $DB->GetRow('select IM_ID,IM_time,IM_ipCN,IM_num,IM_userID,IM_username,IM_content,IM_addiContent from '. OT_dbPref .'infoMessage where IM_ID='. $replyUserID .' and IM_infoID='. $infoID);
		if ($row){
			$addiContent .= $row['IM_ID'] .'[|]'. $row['IM_userID'] .'[|]'. $row['IM_username'] .'[|]'. $row['IM_ipCN'] .'[|]'. $row['IM_content'] .'[|]'. $row['IM_time'] .'[|]'. $row['IM_num'];
			if (strlen($row['IM_addiContent']) > 10){
				$addiContent .= '[arr]'. $row['IM_addiContent'];
			}
		}
	}

	$todayTime = TimeDate::Get();

	$record = array();
	$record['IM_type']			= 'pc';
	$record['IM_infoID']		= $infoID;
	$record['IM_time']			= $todayTime;
	$record['IM_ip']			= $userIP;
	$record['IM_ipCN']			= $ipInfoArr['address'];
	$record['IM_num']			= intval($DB->GetOne('select max(IM_num) from '. OT_dbPref .'infoMessage where IM_infoID='. $infoID .''))+1;
	$record['IM_userID']		= $userID;
	$record['IM_username']		= $username;
	$record['IM_content']		= $content;
	$record['IM_contentMd5']	= md5($content);
	$record['IM_addiContent']	= $addiContent;
	$record['IM_state']			= $infoSysArr['IS_newsReplyAudit'];

	$judRes = $DB->InsertParam('infoMessage',$record);
		if ($judRes){
			$alertRes = '成功';

			$theme = $DB->GetOne('select IF_theme from '. OT_dbPref .'info where IF_ID='. $infoID);
			AreaApp::MessageSend('infoMessage', '有用户（'. $username .'）发表文章《'. $theme .'》评论（'. $content .'）。[PC端]【'. $todayTime .'】');

			$DB->query('update '. OT_dbPref .'info set IF_replyNum=IF_replyNum+1 where IF_ID='. $infoID);
			if ($infoSysArr['IS_newsReplyAudit'] == 0){
				echo('alert("提交成功，待管理员审核通过后才会显示出来。");$id("replyForm").reset();ResetVerCode();');
			}else{
				$lastID = $DB->GetOne('select max(IM_ID) from '. OT_dbPref .'infoMessage');
				$usArr = Users::AddScore('infoMessage', $userID, $lastID, $infoID, '', $content);
				echo('alert("提交成功。'. $usArr['note'] .'");$id("replyForm").reset();ResetVerCode();LoadReplyList('. $infoID .');document.location.href="#scroll_reply";');
			}
		}else{
			$alertRes = '失败';
			echo('alert("提交失败，请刷新页面后再重新提交。");$id("replyForm").reset();ResetVerCode();');
		}
	
}



// 发送评论
function MessageSend(){
	global $DB,$systemArr,$infoSysArr,$tplSysArr;

	$dataID			= OT::GetInt2( OT::ParaArr('id') );
	$webPathPart	= Area::WppSign(OT::GetStr('webPathPart'));

	$pageSize	= $infoSysArr['IS_newsReplyNum'];		//每页条数
	$page		= OT::GetInt('page');
	$showRow=$DB->GetLimit('select IM_ID,IM_time,IM_num,IM_userID,IM_username,IM_ipCN,IM_content,IM_addiContent,IM_isReply,IM_reply,IM_vote1,IM_vote2 from '. OT_dbPref .'infoMessage where IM_infoID='. $dataID .' and IM_state=1 order by IM_time DESC',$pageSize,$page);
		if (! $showRow){
			echo('<br /><center class="font1_1">暂无评论</center>');
		}else{
			$recordCount=$DB->GetRowCount();
			$pageCount=ceil($recordCount/$pageSize);
			if ($page < 1 || $page > $pageCount){$page=1;}

			$number=1+($page-1)*$pageSize;
			$rowCount = count($showRow);

			echo('<ul>');
			for ($i=0; $i<$rowCount; $i++){
				if ($showRow[$i]['IM_userID']>0){
					$replyName='<span style="color:red;">会员：</span>';
					$showRow[$i]['IM_username'] = Str::PartHide($showRow[$i]['IM_username']);
				}else{
					$replyName='评论者：';
				}
				if (strlen($showRow[$i]['IM_ipCN'])>0 && strpos($tplSysArr['TS_messageEvent'],'|IP|')!==false){
					$ipCN = '&ensp;<span class="font1_2d">['. $showRow[$i]['IM_ipCN'] .']</span>';
				}else{
					$ipCN = '';
				}
				$addiContent = Area::GenTie($showRow[$i]['IM_ID'], $showRow[$i]['IM_addiContent'], $tplSysArr['TS_messageEvent'], 3, $webPathPart);
				echo('
				<li>
					<div class="username">
						<div class="right font1_2d">
							<span class="font2_2" style="cursor:pointer;" onclick=\'ReplyUser("'. $showRow[$i]['IM_ID'] .'","'. $showRow[$i]['IM_num'] .'楼 '. $showRow[$i]['IM_username'] .'");\'>【回复】</span>&ensp;&ensp;
							<span style="color:#5ed317;cursor:pointer;" onclick="UserVote(\'news\','. $showRow[$i]['IM_ID'] .',1);"><img src="'. $webPathPart .'inc_img/userDing.gif" align="bottom" valign="top" alt="顶" title="顶" style="margin-right:2px;" /><span id="vote1_'. $showRow[$i]['IM_ID'] .'">'. $showRow[$i]['IM_vote1'] .'</span></span>&ensp;&ensp;
							<span style="color:#ff8056;cursor:pointer;" onclick="UserVote(\'news\','. $showRow[$i]['IM_ID'] .',2);"><img src="'. $webPathPart .'inc_img/userCai.gif" align="bottom" valign="top" alt="踩" title="踩" style="margin-right:2px;" /><span id="vote2_'. $showRow[$i]['IM_ID'] .'">'. $showRow[$i]['IM_vote2'] .'</span></span>&ensp;&ensp;
							'. TimeDate::Get('Y-m-d H:i',$showRow[$i]['IM_time']) .'
						</div>
						<img src="'. $webPathPart .'inc_img/user.gif" /><b>'. $showRow[$i]['IM_num'] .'楼</b>&ensp;'. $replyName .''. $showRow[$i]['IM_username'] . $ipCN .'
					</div>
					<div class="note">'. Area::FaceSignToImg(Area::MessageEventDeal($showRow[$i]['IM_content'],$tplSysArr['TS_messageEvent']),$webPathPart) .'</div>
					'. $addiContent .'
					');
					if ($showRow[$i]['IM_isReply'] == 1){
						echo('<div class="admin"><b>'. $infoSysArr['IS_newsReplyName'] .'：</b>'. Area::FaceSignToImg($showRow[$i]['IM_reply'],$webPathPart) .'</div>');
					}
				echo('
				</li><div class="clr"></div>
				');
			}

			echo('
			</ul><div class="clr"></div>

			<table cellpadding="0" cellspacing="0" align="center" class="listNavBox"><tr><td>
			'. Nav::Ajax('replyList',$pageCount,$pageSize,$recordCount) .'
			</td></tr></center>
			');
		}
	unset($showRow);
}



// 发送评论填写框
function MessageWrite(){
	global $DB,$systemArr,$infoSysArr,$tplSysArr,$webPathPart;

	$dataID			= OT::GetInt2( OT::ParaArr('id') );
	$isReply		= OT::GetInt('isReply');
	$webPathPart	= Area::WppSign(OT::GetStr('webPathPart'));

	$infoexe=$DB->query('select IF_ID,IF_isReply from '. OT_dbPref .'info where IF_ID='. $dataID);
		if ($row = $infoexe->fetch()){
			$IF_isReply		= $row['IF_isReply'];
		}else{
			echo('<div style="text-align:center;font-size:14px;margin:30px 0 50px 0;">找不到该文章信息</div>');
			// $IF_isReply		= $isReply;
		}
	unset($infoexe);
	
	$username = Users::Username();
	if (($infoSysArr['IS_isNewsReply']==10 || $IF_isReply==10) && $username==''){
		echo('
		<center style="font-size:14px;margin:30px 0 50px 0;">
			为了防止灌水，发表评论，请先 <a class="font2_1" href="'. Users::SysUrl('login','&force=1&isBack=1',$webPathPart) .'">[登录]</a>，如没账号请先 <a class="font2_1" href="'. Users::SysUrl('reg','&force=1&isBack=1',$webPathPart) .'">[注册]</a>
		</center>
		');
	}else{
		$userIP	= Users::GetIp();
		if ($username == ''){ $replyName = '游客'; }else{ $replyName = $username; }
		$rndMd5 = md5(md5(OT_SiteID . session_id()) . OT_SiteID . $userIP);

		echo('
		<form id="replyForm" name="replyForm" method="post" action="'. $webPathPart .'news_deal.php?mudi=message" onsubmit="return CheckReplyForm();">
		<script language="javascript" type="text/javascript">document.write(\'<input type="hidden" name="backURL" value="\'+ document.location.href +\'" />\')</script>
		<input type="hidden" id="rndMd5" name="rndMd5" value="'. $rndMd5 .'" />
		<input type="hidden" name="infoID" value="'. $dataID .'" />
		<input type="hidden" name="isReply" value="'. $IF_isReply .'" />
		<input type="hidden" id="replyUserID" name="replyUserID" value="0" />
		<input type="hidden" id="replyContentMaxLen" name="replyContentMaxLen" value="'. $infoSysArr['IS_newsReplyMaxLen'] .'" />
		<table id="replyTable" align="center" style="margin:0 auto;">
		<tr>
			<td align="left">
				<a id="replyArea" name="replyArea"></a>
				<span style="font-weight:bold;" class="font2_2 pointer" onclick=\'FaceShow("faceInitBox","replyContent");\'>[表情]</span>
				&ensp;&ensp;<span id="replyUserStr" style="color:blue;font-weight:bold;"></span>
				<div id="faceInitBox" style="width:98%;display:none;overflow:hidden;"></div>
			</td>
		</tr>
		<tr>
			<td>
				<textarea id="replyContent" name="replyContent"></textarea>
			</td>
		</tr>
		<tr>
			<td align="left">
				<div class="right"><span id="conMaxLenBox" class="font2_2"></span><input type="submit" value="" class="replyBtn button" /></div>
				<table cellpadding="0" cellspacing="0"><tr><td id="replyUserBox">
				');
				if (Users::UserID()>0 && strlen($username)>0){
					echo('会员：'. $username .'<input type="hidden" id="replyUser" name="replyUser" value="'. $username .'" maxlength="25" />');
				}else{
					if (strpos(''. $tplSysArr['TS_messageEvent'],'|noRevName|') !== false){
						echo('评论者：'. $replyName .'<input type="hidden" id="replyUser" name="replyUser" value="'. $replyName .'" />');
					}else{
						echo('评论者：<input type="text" id="replyUser" name="replyUser" value="'. $replyName .'" style="width:90px;" maxlength="25" />');
					}
				}
				echo('&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;');
				if (OT_OpenVerCode && strpos($systemArr['SYS_verCodeStr'],'|newsReply|')!==false){
					echo('验证码：</td><td>'. Area::VerCode('replyForm','verCode','100px') .'');
				}
				echo('
				</td></tr></table>
			</td>
		</tr>
		</table>
		</form>
		');
	}
}



// 发送文章内容
function ContentSend(){
	global $DB,$infoSysArr,$userSysArr;

	$dataID			= OT::GetInt2( OT::ParaArr('id') );
	$page			= OT::GetInt('page');
	$isCut			= OT::GetStr('isCut');	// true执行扣分操作
	$webPathPart	= Area::WppSign(OT::GetStr('webPathPart'));
	$outputID		= 'newsContent';

	$infoexe = $DB->query('select IF_typeStr,IF_type1ID,IF_type2ID,IF_type3ID,IF_theme,IF_tabID,IF_content,IF_pageNum,IF_userID,IF_isCheckUser,IF_freeGroupList,IF_userGroupList,IF_userLevel,IF_score1,IF_score2,IF_score3,IF_cutScore1,IF_cutScore2,IF_cutScore3,IF_scoreUserList,IF_file,IF_fileName,IF_fileStr,IF_state,IF_infoTypeDir,IF_datetimeDir,IF_isEnc,IF_encContent,IF_mediaFile,IF_addition,IF_cutQuickMoney,IF_pwdAnswer,IF_pwdImg,IF_pwdNote,IF_payUserMul,IF_readNum from '. OT_dbPref .'info where IF_ID='. $dataID);
		if (! $row = $infoexe->fetch()){
			die('<br /><center>记录不存在</center>');
		}
		if ($row['IF_state'] == 0){
			die('<br /><center>该记录已关闭</center>');
		}

		$IF_typeStr			= $row['IF_typeStr'];
		$IF_type1ID			= $row['IF_type1ID'];
		$IF_type2ID			= $row['IF_type2ID'];
		$IF_type3ID			= $row['IF_type3ID'];
		$IF_theme			= $row['IF_theme'];
		if ($row['IF_tabID'] > 0){
			$IF_content		= Info::GetTabContent($row['IF_tabID'], $dataID);
		}else{
			$IF_content		= $row['IF_content'];
		}
		$IF_pageNum			= $row['IF_pageNum'];
		$IF_userID			= $row['IF_userID'];
		$IF_isCheckUser		= $row['IF_isCheckUser'];
		$IF_freeGroupList	= $row['IF_freeGroupList'];
		$IF_userGroupList	= $row['IF_userGroupList'];
		$IF_userLevel		= $row['IF_userLevel'];
		$IF_score1			= $row['IF_score1'];
		$IF_score2			= $row['IF_score2'];
		$IF_score3			= $row['IF_score3'];
		$IF_cutScore1		= $row['IF_cutScore1'];
		$IF_cutScore2		= $row['IF_cutScore2'];
		$IF_cutScore3		= $row['IF_cutScore3'];
		$IF_scoreUserList	= $row['IF_scoreUserList'];
		$IF_file			= $row['IF_file'];
		$IF_fileName		= $row['IF_fileName'];
		$IF_fileStr			= $row['IF_fileStr'];
		$IF_infoTypeDir		= $row['IF_infoTypeDir'];
		$IF_datetimeDir		= $row['IF_datetimeDir'];
		$IF_isEnc			= $row['IF_isEnc'];
		$IF_encContent		= $row['IF_encContent'];
		$IF_mediaFile		= $row['IF_mediaFile'];
		$IF_addition		= $row['IF_addition'] .'';
		$IF_cutQuickMoney	= $row['IF_cutQuickMoney'];
		$IF_pwdAnswer		= $row['IF_pwdAnswer'];
		$IF_pwdImg			= $row['IF_pwdImg'];
		$IF_pwdNote			= $row['IF_pwdNote'];
		$IF_payUserMul		= $row['IF_payUserMul'];
		$IF_readNum			= $row['IF_readNum'];
	unset($infoexe);

	$isCheckUser = -1;
	$IT_hiddenContent1 = $IT_hiddenContent2 = '';
	if (strpos($IF_addition,'|noInfoType|') === false){
		if ($IF_type2ID > 0){
			$type2exe = $DB->query('select IT_hiddenContent1,IT_hiddenContent2,IT_addition,IT_score1,IT_score2,IT_score3,IT_score4,IT_score5,IT_cutScore1,IT_cutScore2,IT_cutScore3,IT_cutScore4,IT_cutScore5,IT_userGroupList,IT_freeGroupList,IT_cutQuickMoney,IT_pwdAnswer,IT_pwdImg,IT_pwdNote from '. OT_dbPref .'infoType where IT_ID='. $IF_type2ID);
			if ($row2 = $type2exe->fetch()){
				$isCheckUser = Info::InfoTypeIsCheckUser($row2['IT_addition'], $IF_addition);
				if ($isCheckUser != -1){
					$IF_isCheckUser = $isCheckUser;
					if (strpos($row2['IT_addition'],'|act_hiddenContent1|') !== false){
						$IT_hiddenContent1 = $row2['IT_hiddenContent1'];
					}
					if (strpos($row2['IT_addition'],'|act_hiddenContent2|') !== false){
						$IT_hiddenContent1 = $row2['IT_hiddenContent2'];
					}
					if (strpos($row2['IT_addition'],'|act_checkUser|') !== false){
						if (strpos($row2['IT_addition'],'|checkUser|') !== false){
							$IF_score1			= $row2['IT_score1'];
							$IF_score2			= $row2['IT_score2'];
							$IF_score3			= $row2['IT_score3'];
							$IF_score4			= $row2['IT_score4'];
							$IF_score5			= $row2['IT_score5'];
							$IF_cutScore1		= $row2['IT_cutScore1'];
							$IF_cutScore2		= $row2['IT_cutScore2'];
							$IF_cutScore3		= $row2['IT_cutScore3'];
							$IF_cutScore4		= $row2['IT_cutScore4'];
							$IF_cutScore5		= $row2['IT_cutScore5'];
							$IF_userGroupList	= $row2['IT_userGroupList'];
							$IF_freeGroupList	= $row2['IT_freeGroupList'];
							$IF_addition .= '|checkUser|';
						}else{
							$IF_addition = str_replace('|checkUser|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkReply|') !== false){
						if (strpos($row2['IT_addition'],'|checkReply|') !== false){
							$IF_addition .= '|checkReply|';
						}else{
							$IF_addition = str_replace('|checkReply|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkQuick|') !== false){
						if (strpos($row2['IT_addition'],'|checkQuick|') !== false){
							$IF_cutQuickMoney	= $row2['IT_cutQuickMoney'];
							$IF_addition .= '|checkQuick|';
						}else{
							$IF_addition = str_replace('|checkQuick|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkPwd|') !== false){
						if (strpos($row2['IT_addition'],'|checkPwd|') !== false){
							$IF_pwdAnswer		= $row2['IT_pwdAnswer'];
							$IF_pwdImg			= $row2['IT_pwdImg'];
							$IF_pwdNote			= $row2['IT_pwdNote'];
							$IF_addition .= '|checkPwd|';
						}else{
							$IF_addition = str_replace('|checkPwd|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkXcxAd|') !== false){
						if (strpos($row2['IT_addition'],'|checkXcxAd|') !== false){
							$IF_addition .= '|checkXcxAd|';
						}else{
							$IF_addition = str_replace('|checkXcxAd|','',$IF_addition);
						}
					}
				}
			}
			unset($type2exe);

		}elseif ($IF_type1ID > 0){
			$type2exe = $DB->query('select IT_hiddenContent1,IT_hiddenContent2,IT_addition,IT_score1,IT_score2,IT_score3,IT_score4,IT_score5,IT_cutScore1,IT_cutScore2,IT_cutScore3,IT_cutScore4,IT_cutScore5,IT_userGroupList,IT_freeGroupList,IT_cutQuickMoney,IT_pwdAnswer,IT_pwdImg,IT_pwdNote from '. OT_dbPref .'infoType where IT_ID='. $IF_type1ID);
			if ($row2 = $type2exe->fetch()){
				$isCheckUser = Info::InfoTypeIsCheckUser($row2['IT_addition'], $IF_addition);
				if ($isCheckUser != -1){
					$IF_isCheckUser = $isCheckUser;
					if (strpos($row2['IT_addition'],'|act_hiddenContent1|') !== false){
						$IT_hiddenContent1 = $row2['IT_hiddenContent1'];
					}
					if (strpos($row2['IT_addition'],'|act_hiddenContent2|') !== false){
						$IT_hiddenContent1 = $row2['IT_hiddenContent2'];
					}
					if (strpos($row2['IT_addition'],'|act_checkUser|') !== false){
						if (strpos($row2['IT_addition'],'|checkUser|') !== false){
							$IF_score1			= $row2['IT_score1'];
							$IF_score2			= $row2['IT_score2'];
							$IF_score3			= $row2['IT_score3'];
							$IF_score4			= $row2['IT_score4'];
							$IF_score5			= $row2['IT_score5'];
							$IF_cutScore1		= $row2['IT_cutScore1'];
							$IF_cutScore2		= $row2['IT_cutScore2'];
							$IF_cutScore3		= $row2['IT_cutScore3'];
							$IF_cutScore4		= $row2['IT_cutScore4'];
							$IF_cutScore5		= $row2['IT_cutScore5'];
							$IF_userGroupList	= $row2['IT_userGroupList'];
							$IF_freeGroupList	= $row2['IT_freeGroupList'];
							$IF_addition .= '|checkUser|';
						}else{
							$IF_addition = str_replace('|checkUser|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkReply|') !== false){
						if (strpos($row2['IT_addition'],'|checkReply|') !== false){
							$IF_addition .= '|checkReply|';
						}else{
							$IF_addition = str_replace('|checkReply|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkQuick|') !== false){
						if (strpos($row2['IT_addition'],'|checkQuick|') !== false){
							$IF_cutQuickMoney	= $row2['IT_cutQuickMoney'];
							$IF_addition .= '|checkQuick|';
						}else{
							$IF_addition = str_replace('|checkQuick|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkPwd|') !== false){
						if (strpos($row2['IT_addition'],'|checkPwd|') !== false){
							$IF_pwdAnswer		= $row2['IT_pwdAnswer'];
							$IF_pwdImg			= $row2['IT_pwdImg'];
							$IF_pwdNote			= $row2['IT_pwdNote'];
							$IF_addition .= '|checkPwd|';
						}else{
							$IF_addition = str_replace('|checkPwd|','',$IF_addition);
						}
					}
					if (strpos($row2['IT_addition'],'|act_checkXcxAd|') !== false){
						if (strpos($row2['IT_addition'],'|checkXcxAd|') !== false){
							$IF_addition .= '|checkXcxAd|';
						}else{
							$IF_addition = str_replace('|checkXcxAd|','',$IF_addition);
						}
					}
				}
			}
			unset($type2exe);
		}
	}

	if ($IF_isCheckUser > 0){
		$judPass = $judPassPwd = $judPassAd = $judPassQuick = $judPassReply = $judPassScore = false;
		$chkName = $chkPwdStr = $chkAdStr = $chkQuickStr = $chkReplyStr = $chkScoreStr = '';

		if (strpos($IF_addition,'|checkPwd|') !== false && AppNewsPwd::Jud()){
			$chkName = '输入密码可见';
			$passArr = AppNewsPwd::InfoReadPassArr($dataID, $IF_pwdAnswer);
			if ($passArr['res']){
				$judPassPwd = true;
				$judPass = true;
			}else{
				// 获取 输入密码可见 密码框页面
				$chkPwdStr = AppNewsPwd::InfoReadItem($dataID, $webPathPart, $IF_pwdImg, $IF_pwdNote, OT_MODE);
			}
		}

		if (strpos($IF_addition,'|checkXcxAd|') !== false && AppXcxAd::Jud() && $judPass == false){
			$chkName = '小程序看广告领奖励';
			$passArr = AppXcxAd::InfoReadPassArr($dataID);
			if ($passArr['res']){
				$judPassAd = true;
				$judPass = true;
			}else{
				// 获取 小程序看广告领奖励 卡密框页面
				$chkAdStr = AppXcxAd::InfoReadItem($dataID, $webPathPart, OT_MODE);
			}
		}

		if (strpos($IF_addition,'|checkQuick|') !== false && AppMoneyQuick::Jud() && $judPass == false){
			$chkName = '直接在线支付';
			$passArr = AppMoneyQuick::InfoReadPassArr($dataID);	// array('res'=>false/true, 'note'=>'原因')
			if ($passArr['res']){
				$judPassQuick = true;
				$judPass = true;
			}else{
				// 获取 直接在线支付 付款页面
				$chkQuickStr = AppMoneyQuick::InfoReadItem($dataID, $IF_cutQuickMoney, $webPathPart, OT_MODE);
			}
		}

		if (strpos($IF_addition,'|checkReply|') !== false && $judPass == false){
			$chkName = '会员发评论/回复可见';
			$passArr = Info::InfoReadPassArr('reply', $dataID);
			if ($passArr['res']){
				$judPassReply = true;
				$judPass = true;
			}else{
				// 获取 会员回复可见 提示内容
				$chkReplyStr = '<div class="newsReplyItem">会员回复可见（'. $passArr['note'] .'）</div>';
			}
		}

		// 计算虚假人数
		// IS_payUserMul 0采用文章各自设置，1+全局设置，-1不显示全局已阅读人数，-2关闭全局虚假人数
		$payUserNum = Info::PayUserCount($IF_scoreUserList);
		if (! isset($infoSysArr['IS_payUserMul'])){ $infoSysArr['IS_payUserMul'] = 0; }
		if ($infoSysArr['IS_payUserMul'] > 0){
			$payUserNum += floor($IF_readNum / $infoSysArr['IS_payUserMul']);
		}elseif ($infoSysArr['IS_payUserMul'] == -1){
			$payUserNum = 0;
		}elseif ($infoSysArr['IS_payUserMul'] == -2){
			// 关闭全局虚假人数
		}else{
			// IF_payUserMul 0关闭虚假人数，-1不显示已阅读人数
			if ($IF_payUserMul > 0){
				$payUserNum += floor($IF_readNum / $IF_payUserMul);
			}elseif ($IF_payUserMul == -1){
				$payUserNum = 0;
			}
		}

		if (strpos($IF_addition,'|checkUser|') !== false && $judPass == false){
			$chkName = '仅限会员阅读';
			$judRead = 1;		// 判断阅读积分是符合要求1，还是不符合0
			$judCut = 1;		// 判断付费积分是符合要求1，还是不符合0，已扣分2
			$readStr = '';		// 限制阅读积分信息
			$cutStr = '';		// 付费阅读积分信息
			$userReadStr = '';	// 会员限制阅读符合信息
			$userCutStr = '';	// 会员付费阅读符合信息
			$cutUserSql = '';	// 会员扣分sql语句
			$payNote = '';		// 会员付费阅读信息
			if ($IF_score1 > 0){
				$readStr .= '&ensp;&ensp;'. $userSysArr['US_score1Name'] .'>='. $IF_score1;
			}
			if ($userSysArr['US_isScore2'] == 1 && $IF_score2 > 0){
				$readStr .= '&ensp;&ensp;'. $userSysArr['US_score2Name'] .'>='. $IF_score2;
			}
			if ($userSysArr['US_isScore3'] == 1 && $IF_score3 > 0){
				$readStr .= '&ensp;&ensp;'. $userSysArr['US_score3Name'] .'>='. $IF_score3;
			}
			if ($IF_cutScore1 > 0){
				$cutStr .= '&ensp;&ensp;'.  $userSysArr['US_score1Name'] .':'. $IF_cutScore1;
			}
			if ($userSysArr['US_isScore2'] == 1 && $IF_cutScore2 > 0){
				$cutStr .= '&ensp;&ensp;'. $userSysArr['US_score2Name'] .':'. $IF_cutScore2;
			}
			if ($userSysArr['US_isScore3'] == 1 && $IF_cutScore3 > 0){
				$cutStr .= '&ensp;&ensp;'. $userSysArr['US_score3Name'] .':'. $IF_cutScore3;
			}
			if (strlen($readStr) > 0){ $readStr = '<br />需要会员'. $readStr; }

			$userRow = Users::Open('get',',UE_username,UE_score1,UE_score2,UE_score3,UE_state,UE_groupID,UE_isGroupTime,UE_groupTime','',$judUserErr);
				if ((! $userRow) || $judUserErr != ''){
					if (AppMoneyQuick::Jud()){
						$moneySysArr = Cache::PhpFile('moneySys');
						if ($moneySysArr['MS_quickInfoDay'] <= 0){
							$chkQuickStr = '';
						}
					}
					$chkScoreStr = '登录后才能阅读，<!-- '. $judUserErr .' -->如有账号请先 <a style="color:red;" href="'. Users::SysUrl('login','&force=1&isBack=1',$webPathPart) .'">[登录]</a>，如没账号请先 <a style="color:red;" href="'. Users::SysUrl('reg','&force=1&isBack=1',$webPathPart) .'">[注册]</a>'. $readStr;
					DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
				}
				if ($userRow['UE_state'] == 0){
					$chkScoreStr = '您当前状态 未审核，审核通过后才可阅读。'. $readStr;
					DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
				}
			$groupID = UserGroup::CurrId($userRow['UE_groupID'], $userRow['UE_isGroupTime'], $userRow['UE_groupTime']);

			if ((strlen(''. $IF_freeGroupList) > 1 && strpos($IF_freeGroupList,'['. $groupID .']') !== false) || 
				($IF_userID >= 1 && $IF_userID == $userRow['UE_ID']) ||
				(strlen($readStr . $cutStr) == 0 && (strlen(''. $IF_userGroupList) <= 1 || strpos($IF_userGroupList,'['. $groupID .']') !== false))){
				// 在免费阅读组的 或者 投稿人本人 或者 限制和付费阅读积分都为0 可直接阅读
				$judPassScore = true;
				$judPass = true;

			}else{
				if (strlen(''. $IF_userGroupList) > 1 && strpos($IF_userGroupList,'['. $groupID .']') === false){
					// 付费阅读组判断逻辑
					$allowList = $alertStr = '';
					if (AppUserGroup::Jud()){
						$alertStr .= '您可以 ';
						if (AreaApp::JudPayMode()){
							$alertStr .= '<a href="'. Users::SysUrl('onlinePay','&isBack=1',$webPathPart) .'" target="_blank" style="font-weight:bold;text-decoration:underline;color:red;">在线充值</a> 然后 ';
						}
						$alertStr .= '<a href="'. Users::SysUrl('userAndGroup','',$webPathPart) .'" target="_blank" style="font-weight:bold;text-decoration:underline;color:red;">会员组开通/更换</a> 更高级用户组';
					}

					if (strlen($IF_freeGroupList) > 2){
						$allowTemp = '';
						$groupList = str_replace(array('[',']'), '', $IF_freeGroupList);
						$groupexe = $DB->query('select UG_theme from '. OT_dbPref .'userGroup where UG_ID in ('. $groupList .')');
						while ($grs = $groupexe->fetch()){
							$allowTemp .= '【'. $grs['UG_theme'] .'】';
						}
						if (strlen($allowTemp) > 0){
							$allowList .= '<div style="color:blue;">免费阅读组'. $allowTemp .'</div>';
						}
						unset($groupexe);
					}

					$allowTemp = '';
					$groupList = str_replace(array('[',']'), '', $IF_userGroupList);
					$groupexe = $DB->query('select UG_theme from '. OT_dbPref .'userGroup where UG_ID in ('. $groupList .')');
					while ($grs = $groupexe->fetch()){
						$allowTemp .= '【'. $grs['UG_theme'] .'】';
					}
					if (strlen($allowTemp) > 0){
						$allowList .= '<div style="color:blue;">限制/付费阅读组'. $allowTemp .'</div>';
					}
					unset($groupexe);

					$chkScoreStr = '您当前所在的用户组【'. UserGroup::CurrName($groupID) .'】无权限阅读。'. $allowList . $readStr .'<div style="color:#000;">'. $alertStr .'</div>';
					DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
				}

				$UE_ID			= $userRow['UE_ID'];
				$UE_username	= $userRow['UE_username'];
				$UE_score1		= $userRow['UE_score1'];
				$UE_score2		= $userRow['UE_score2'];
				$UE_score3		= $userRow['UE_score3'];

				if (strpos(''. $IF_scoreUserList,'['. $UE_ID .']') !== false){
					// 在付款名单里可直接阅读
					$judCut = 2;

				}else{
					//	if ($userSysArr['US_isScore1'] == 1){
						if ($UE_score1 < $IF_score1){
							$userReadStr .= '&ensp;&ensp;'. $userSysArr['US_score1Name'] .'：'. $UE_score1 .'';
							$judRead = 0;
						}
						if ($UE_score1 < $IF_cutScore1){
							$userCutStr .= '&ensp;&ensp;'. $userSysArr['US_score1Name'] .'：'. $UE_score1 .'';
							$judCut = 0;
						}
						$cutUserSql .= 'update '. OT_dbPref .'users set UE_score1=UE_score1-'. $IF_cutScore1 .'';
						$payNote .= $userSysArr['US_score1Name'] .'：'. $UE_score1 .'；';
					//	}
					if ($userSysArr['US_isScore2'] == 1){
						if ($UE_score2 < $IF_score2){
							$userReadStr .= '&ensp;&ensp;'. $userSysArr['US_score2Name'] .'：'. $UE_score2 .'';
							$judRead = 0;
						}
						if ($UE_score2 < $IF_cutScore2){
							$userCutStr .= '&ensp;&ensp;'. $userSysArr['US_score2Name'] .'：'. $UE_score2 .'';
							$judCut = 0;
						}
						$cutUserSql .= ',UE_score2=UE_score2-'. $IF_cutScore2 .'';
						$payNote .= $userSysArr['US_score2Name'] .'：'. $UE_score2 .'；';
					}
					if ($userSysArr['US_isScore3'] == 1){
						if ($UE_score3 < $IF_score3){
							$userReadStr .= '&ensp;&ensp;'. $userSysArr['US_score3Name'] .'：'. $UE_score3 .'';
							$judRead = 0;
						}
						if ($UE_score3 < $IF_cutScore3){
							$userCutStr .= '&ensp;&ensp;'. $userSysArr['US_score3Name'] .'：'. $UE_score3 .'';
							$judCut = 0;
						}
						$cutUserSql .= ',UE_score3=UE_score3-'. $IF_cutScore3 .'';
						$payNote .= $userSysArr['US_score3Name'] .'：'. $UE_score3 .'；';
					}

					$payAlert = '';
					if (AreaApp::JudPayMode()){
						$payAlert = '，请先<a href="'. Users::SysUrl('onlinePay','&isBack=1',$webPathPart) .'" target="_blank" style="font-weight:bold;text-decoration:underline;color:red;">在线充值</a>';
					}
					if (strlen($userReadStr) > 0){ $userReadStr = '<div style="color:#000;">当前会员'. $userReadStr . $payAlert .'</div>'; }
					if (strlen($userCutStr) > 0){ $userCutStr = '<div style="color:#000;">当前会员'. $userCutStr . $payAlert .'</div>'; }
					if (strlen($payNote) > 0){ $payNote .= '扣积分阅读 '. $payNote; }
					if ($judRead == 0){
						$chkScoreStr = '阅读权限不足。'. $readStr . $userReadStr;
						DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
					}

					if ($isCut == 'true'){
						// 执行会员扣分操作
						if ($judCut == 0){
							// 条件不符合无法扣分
							$chkScoreStr = '积分不足，无法阅读。<br />阅读需扣积分'. $cutStr . $userCutStr;
							DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);

						}elseif ($judCut == 1){
							// 条件符合进行扣分
							$cutUserSql .= ' where UE_ID='. $UE_ID;
							$DB->query($cutUserSql);
							$DB->query('update '. OT_dbPref .'info set IF_scoreUserList='. $DB->ForStr($IF_scoreUserList .'['. $UE_ID .']') .' where IF_ID='. $dataID);

							// 付费阅读记录
							$payDataArr = array();
							$payDataArr['IPD_type']		= 'info';
							$payDataArr['IPD_type2']	= 'score';
							$payDataArr['IPD_time']		= TimeDate::Get();
							$payDataArr['IPD_userID']	= $UE_ID;
							$payDataArr['IPD_username']	= $UE_username;
							$payDataArr['IPD_dataID']	= $dataID;
							$payDataArr['IPD_dataName']	= $IF_theme;
							$payDataArr['IPD_note']		= $payNote;
							$payDataArr['IPD_state']	= 1;
							$DB->InsertParam('infoPayData',$payDataArr);

							$judCut = 2;

							if (AppUserScore::IsAdd($IF_cutScore1, $IF_cutScore2, $IF_cutScore3)){
								// 扣分积分记录
								$scoreArr = array();
								$scoreArr['UM_userID']		= $UE_ID;
								$scoreArr['UM_username']	= $UE_username;
								$scoreArr['UM_type']		= 'read';
								$scoreArr['UM_dataID']		= $dataID;
								$scoreArr['UM_typeStr']		= $IF_typeStr;
								$scoreArr['UM_type1ID']		= $IF_type1ID;
								$scoreArr['UM_type2ID']		= $IF_type2ID;
								$scoreArr['UM_type3ID']		= $IF_type3ID;
								$scoreArr['UM_score1']		= $IF_cutScore1*(-1);
								$scoreArr['UM_score2']		= $IF_cutScore2*(-1);
								$scoreArr['UM_score3']		= $IF_cutScore3*(-1);
								$scoreArr['UM_remScore1']	= $UE_score1 - $IF_cutScore1;
								$scoreArr['UM_remScore2']	= $UE_score2 - $IF_cutScore2;
								$scoreArr['UM_remScore3']	= $UE_score3 - $IF_cutScore3;
								$scoreArr['UM_note']		= '阅读收费文章['. Info::InfoTypeCN($IF_type1ID, $IF_type2ID, $IF_type3ID) .']《'. $IF_theme .'》';
								AppUserScore::AddData($scoreArr);
							}
							// 投稿积分分成 插件
							AppNewsGain::AddGainScore($dataID, $IF_theme, $UE_username, $IF_userID, $IF_cutScore1, $IF_cutScore2, $IF_cutScore3, $IF_typeStr, $IF_type1ID, $IF_type2ID, $IF_type3ID);
						}
					}
				}

				if ($judCut == 2){
					$judPassScore = true;
					$judPass = true;

				}elseif ($judCut == 0){
					$chkScoreStr = '阅读需扣积分'. $cutStr . $userCutStr;
					DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);

				}elseif ($judCut == 1 && ($IF_cutScore1 != 0 || $IF_cutScore2 != 0 || $IF_cutScore3 != 0)){
					$chkScoreStr = '阅读需扣积分'. $cutStr . $userCutStr .'<br />您确定阅读吗？<input type="button" value="确定阅读" onclick="CutScoreBtn()" />';
					DieErr($chkScoreStr, $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
				}
			}
		}

		if ($judPass == false){	// strpos($IF_addition,'|checkUser|') === false && 
			// 如果仅限会员阅读没开启，并且前面渠道没审核通过
			DieErr('', $chkReplyStr, $chkQuickStr, $chkPwdStr, $chkAdStr, $payUserNum, $IT_hiddenContent1, $IT_hiddenContent2);
		}

		// 显示内容 正文 或 隐藏内容
		if ($IF_isEnc == 1){
			$content = Content::CloseTags(Info::AddImgAlt($IF_encContent,$IF_theme));
			if ($webPathPart!='../'){ $content = str_replace(InfoImgAdminDir,$webPathPart . InfoImgDir,$content); }

			if ($IF_isCheckUser>0 && $IF_isEnc==1 && strpos($IF_addition,'|encMediaFile|')!==false){
				if ($page < 2){
					$mediaCode = AppVideo::GetMediaCode($IF_mediaFile, $webPathPart, 'ajax');
					if (strpos($IF_addition,'|topMediaFile|')!==false){
						$content = $mediaCode . $content;
					}else{
						$content .= $mediaCode;
					}
				}
			}
			if ($IF_isCheckUser>0 && $IF_isEnc==1 && strpos($IF_addition,'|encFile|')!==false){
				$fileCode = Info::FileList($dataID, $IF_file, $IF_fileName, $IF_fileStr, $infoSysArr['IS_fileTitle'], $infoSysArr['IS_fileStyle'], $webPathPart);
				$content .= $fileCode;
			}

			// echo('【'. $chkName .'】');
			echo($content);

		}else{
			if ($IF_pageNum>0){
				$content	= Content::PageNum($IF_content,$IF_infoTypeDir,$IF_datetimeDir,$dataID,$IF_pageNum,$outputID,$webPathPart);
			}else{
				$content	= Content::PageSign($IF_content,$IF_infoTypeDir,$IF_datetimeDir,$dataID,$outputID,$webPathPart);
			}
			$content = Content::CloseTags(Info::AddImgAlt($content,$IF_theme));
			if ($webPathPart != '../'){ $content = str_replace(InfoImgAdminDir, $webPathPart . InfoImgDir, $content); }

			$wordexe = $DB->query('select * from '. OT_dbPref .'keyWord where KW_isUse=1 order by KW_rank ASC');
				while ($row = $wordexe->fetch()){
					$wapUrl = $row['KW_URL'];
					if ($row['KW_useNum']>0){
						$content = Str::ReplaceSkipMark($content,$row['KW_theme'],'<a href="'. $wapUrl .'" class="keyWord" target="_blank"><strong>'. $row['KW_theme'] .'</strong></a>',$row['KW_useNum']);
					}else{
						$content = Str::ReplaceSkipMark($content,$row['KW_theme'],'<a href="'. $wapUrl .'" class="keyWord" target="_blank"><strong>'. $row['KW_theme'] .'</strong></a>',-1);
					}
				}
			unset($wordexe);

			if (! ($IF_isCheckUser>0 && $IF_isEnc==1 && strpos($IF_addition,'|encMediaFile|')!==false)){
				if ($page < 2){
					$mediaCode = AppVideo::GetMediaCode($IF_mediaFile, $webPathPart, 'ajax');
					if (strpos($IF_addition,'|topMediaFile|')!==false){
						$content = $mediaCode . $content;
					}else{
						$content .= $mediaCode;
					}
				}
			}
			if (! ($IF_isCheckUser>0 && $IF_isEnc==1 && strpos($IF_addition,'|encFile|')!==false)){
				$fileCode = Info::FileList($dataID, $IF_file, $IF_fileName, $IF_fileStr, $infoSysArr['IS_fileTitle'], $infoSysArr['IS_fileStyle'],  $webPathPart);
				$content .= $fileCode;
			}

			echo($content);
		}

	}

}


// 文章内容隐藏框内容
function DieErr($str, $chkReplyStr='', $chkQuickStr='', $chkPwdStr='', $chkAdStr='', $payUserNum=0, $hiddenContent1='', $hiddenContent2=''){
	global $infoSysArr;

	if (strlen($str) > 0){ $str = '<div class="newsUserItem">'. $str .'</div>'; }
	if (strlen($chkReplyStr) > 0){
		if (strlen($str) > 0){ $str .= ErrHr(); }
		$str .= $chkReplyStr;
	}
	if (strlen($chkQuickStr) > 0){
		if (strlen($str) > 0){ $str .= ErrHr(); }
		$str .= $chkQuickStr;
	}
	if (strlen($chkPwdStr) > 0){
		if (strlen($str) > 0){ $str .= ErrHr(); }
		$str .= $chkPwdStr;
	}
	if (strlen($chkAdStr) > 0){
		if (strlen($str) > 0){ $str .= ErrHr(); }
		$str .= $chkAdStr;
	}
	if ($payUserNum > 0){ $payUserStr = '，已有 '. $payUserNum .' 人阅读'; }else{ $payUserStr = ''; }

	die('
	<br />
	<div class="hiddenContent">
		<span class="lockBox"><i class="lockImg"></i>&ensp;隐藏内容'. $payUserStr .'</span>
		<div class="clr"></div>
		<table align="center" class="tabBox"><tr><td class="tdBox">
			<div class="announ1">'. (strlen($hiddenContent1) > 0 ? $hiddenContent1 : $infoSysArr['IS_hiddenContent1']) .'</div>
			'. $str .'
			<div class="announ2">'. (strlen($hiddenContent2) > 0 ? $hiddenContent2 : $infoSysArr['IS_hiddenContent2']) .'</div>
		</td></tr></table>
	</div>
	');
}


// 文章内容隐藏框内容
function ErrHr(){
	return '<table style="width:99%;"><tr><td style="width:45%"><hr /></td><td align="center" class="hrFont">或者</td><td style="width:45%"><hr /></td></tr></table>';
}
?>